// 定义一个全局变量来存储定时器的标识
let timer;

// 倒计时函数
function updateProgressBar() {
    let countdownTime = 30;
    timer = setInterval(() => {
        if (countdownTime > 0) {
            progressBar.style.width = `${(countdownTime / 300) * progressBarWidth}%`;
            countdownTime--;
        } else {
            clearInterval(timer);
            // 倒计时结束后执行的操作
            progressBar.style.width = "0%"; //当倒计时结束，进度条消失
            document.getElementById("audioBodyCountdown").play();
            document.getElementById("Countdown").style.display = "block";
        }
    }, 1000);
}

// 清除倒计时函数
function clearCountdown() {
    clearInterval(timer);
    console.log("倒计时已清除");
}
